import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  CreateDateColumn,
  UpdateDateColumn,
  VersionColumn,
} from 'typeorm';
import UserGender from '../common/enum/UserGender';

@Entity({
  name: 't_user',
})
export default class User {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column('varchar', {
    default: '',
  })
  name: string;

  @Column('varchar', {
    default: '',
  })
  password: string;

  @Column('varchar')
  email: string;

  @Column('varchar', {
    default: '',
  })
  photo: string;

  @Column('varchar', {
    default: '',
  })
  motto: string;

  @Column({
    type: 'enum',
    enum: UserGender,
    default: UserGender.UNDEFIND,
  })
  gender: number; //0 1 2

  @CreateDateColumn()
  createTime: string;

  @UpdateDateColumn()
  updateTime: string;

  @VersionColumn()
  version: number;
}
